<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>授信登录</title>
    <script type="text/javascript">
      Ext.onReady(function(){
        
        var loginId = new Ext.form.TextField({
          fieldLabel: '登录Id',
          allowBlank: false,
          blankText: "登录Id不能为空",
          name: 'login_id',
          anchor: '95%'
        });
        
        var authPassword = new Ext.form.TextField({
          fieldLabel: '授信密码',
          allowBlank: true,
          inputType: 'password',
          name: 'auth_password',
          anchor: '95%'
        });

        //登录
        var loginButton = new Ext.Button({
          text: '登录',
          tooltip: '权限授信登录。',
          iconCls: 'icon-save',
          handler: function(){
            authLoginForm.form.submit({
              success : function (result, resp) {
                if (resp.result.info.indexOf("成功") >= 0) {
                  Ext.MessageBox.show({
                    title: '消息',
                    msg: "授信操作，操作成功！",
                    buttons: Ext.MessageBox.OK,
                    icon: Ext.MessageBox.INFO
                  });
                  roleDiscount = resp.result.discount;
                } else {
                  Ext.MessageBox.show({
                    title: '消息',
                    msg: resp.result.info,
                    buttons: Ext.MessageBox.OK,
                    icon: Ext.MessageBox.WARNING
                  });
                }
                authLoginWin.destroy();
              },
              failure : function (result, request){
                Ext.MessageBox.show({
                  title: '消息',
                  msg: "通讯失败，请从新操作",
                  buttons: Ext.MessageBox.OK,
                  icon: Ext.MessageBox.WARNING
                });
                authLoginWin.destroy();
              }
            });
          }
        });

        //关闭按钮
        var closeButton = new Ext.Button({
          text: '关闭',
          tooltip: '关闭当前窗口，并且当前编辑的信息不能保存。',
          iconCls: 'exit',
          handler: function(){
            authLoginWin.destroy();
          }
        });
        
        var authLoginForm = new Ext.FormPanel({
          labelWidth: 55, // label settings here cascade unless overridden
          url:'/employee/validate_auth',
          frame:true,
          //title: '添加用户',
          labelAlign: 'right',
          bodyStyle:'padding:5px 5px 0',
          width: 200,
          //height:300,
          items: [loginId,authPassword],
          buttons: [loginButton,closeButton]
        });
        authLoginForm.render('auth_login_form');
      })
    </script>
  </head>
  <body>
    <div id="auth_login_form"></div>
  </body>
</html>
